import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class Test2 {

    public static void main(String[] args) {

        File file = new File("t.txt");
        String filePath = "t.txt";
        String contentToWrite = "hehejjjjeh\n";

        try (FileWriter fileWriter = new FileWriter(filePath, true)) {
            fileWriter.write(contentToWrite);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
